Fix illegalstateexception (please ensure no double redirects)