Fix some bugs, still some more to go