fixed bug where on_authentication_fail() callback was not always fired