fixed: sendError after headers sent