Corrected counter script in sensor.py