fixed a few glitches to get it compiling