Fix errors when sending cache headers