Minor fixes to code