Fix errors for when first loading the page for the first time