Fixed a few miscellaneous bugs.