fix the problem of null pointer