Fixing _compare function