Bug fixes found during testing