fixing sensor detection