change redirect checking function