added race conditions