controller.c: removed a race condition with the sensor data