Cleaning up some minor bugs