Moved setting of status code to header() function call to get compatilbility with PHP < 5.4