Fixing redirect bug