Fix #591 - check access to localstorage