minor fixes on pwm, still problems with android side threading