fix a bug causes npe.