Fix null pointer and NRSV