fixes inspired by bugs found by students