Fixed wrong logic in sensor validation