fix unending redirect loop