almost fixed compile errors