fix scroll detection logic