Fixed various minor bugs.