Fixed implementation of comparison operator when null is involved