Cleanup some bugs