Fix atomic counter for iOS