Fix potential segv in pairremove