Fix some bugs, still more to go