bugfixes, needs testing with real adc input