bug fixes and tests for User#delete