Fix potential NPE cases.