Fix bug where local storage not correctly set