Fix similarity sorting