fixes to get avr working, still debugging, prob mem usage