bug fix on surrogate element swap