Fix some issues found during testing.