Fixed cookie redirect bug