fixed bug for nullptr.