[Issue #61] fix premature insertion of pairs