Fixed pwm bug