fix null pointer excp