Misc fixes after code inspection