Clean up some bugs