added localStorage error catching (e.g. "NS_ERROR_FILE_CORRUPTED" in firefox)