Fixed various bugs, compiles for me now