fixing redirect bug