fixed a bug in __cmp__