Fixed redirection bug, added exit after sending header