should use the same res.end entries wrapper functions as line 586