Fixed an issue in the sensing code