compare objects correctly