Small fixes to code