fix bug with calculate scroll