Wrong swap function used