fixes for motion detection