A few minor bug fixes with my code