fixed possibly undefined values in the localStorage