fix null ref exception