fixed compile errors, there are linker problems though