implement workaround to poor language design, fixes occasional race