Fix bug in scroll handling