General bugs v2

A few more bug fixes I have found.