Prevent null pointer exceptions.