Fix auto-scroll bug