add localStorage check and some Fix