inverted pwm was implemented wrong