Use volatile type for counter