fixing atomic integer usage