fix error handling in /register