solved problem of null pointer