fix a bug for mismatch case edge case