fix mangled swap