fix custom layout and scrolling bug