Fix some bugs, test running