Fixed issues spotted by code review