Bug fixes to compile