Squashed a nasty race-condition bug