Fixed a bunch of small bugs based on some user log files.