Fixed bug in __cmp__ method