NOW compiles. some fixes