fixed a few bugs, compiles