fix a race condition in inc