A few bugs found during testing fixed