Fixed for setting the header (critical race condition)