added callback to onRedirect