fixed compile errors. all tests pass