equals implementation, bug fixes.