noheader bug fix attempt
working redirect
fixed error message. Fixed redirect problem
Fixed redirect bug and improved error message logic