Fix the problem with headers sent