fix null pointer excepition

fix null pointer excepition