Handling for case when headers are already sent