Fixed potential problem with null or undefined values when comparing