added null checks for everything that's in the hashCode() method, to try to avoid cryptic errors, at least until the xml validation improves.