Fix the null pointer exception caused by codes for #204