fix a null point bug