Updated code to work with avr-libc v1.8