Fix bug found during testing