Fixing bugs found during testing