fixes and changes to compile on linux