Fixing url redirect bug on login