sensor index out of range bug fixed