Clean up some bugs leftover from merge with Juliane's branch