Fixed memory overwrite bug. This fixes the png writer and led control.