Added check for sent headers on error page