Updated to ensure incorrect passwords are handled