Fixes to code