Merge "Fixed race condition by using a separate counter" into nyc-mr1-dev