semi bodge fix for handling race condition