Fixed an issue which would cause JS errors in case users are being redirected (e.g. on session time out or mandatory time accounting).