Fixed most remaining compile errors