More fixes to code