Fix timing issue where the reposition function would be called too early on initial page load sometimes