fixing redirect and return value