Improve error handling in signin