Additional bug fixes

Just made some small bug fixes to previous commit