Few fixes and applying coding standards

details are in commit messages, there is not much to add