Fixes issue with time check in scrollToElement