fix unnecessary scrolling in some cases