Hackish fix to a bad race condition