Fixed a bug in an equals implementation and fixed some object comparison errors.