fix some place which may cause crash