check null value, avoid memory leak  as possible