Fix bug in initial page load