Removes all wrong reference comparisons