fixed nullptr issue