fixes almost all the compile errors