Some small bug fixes made by Ciff

Ciff the man!