fixed avr atomic operation issues