Fixed some issues found during testing.