Applied fixes from past pull request which are lost because of conflicts.
Applied fixes from past pull request which are lost because of conflicts.

AndreyTepaykin/Platform,AndreyTepaykin/Platform,AndreyTepaykin/Platform,AndreyTepaykin/Platform