remove usages of res.headerSent from core