Fix corner case issue in patch 3f9139c9630f9e763e8f33a94d1c068f46a06db6

Issue #1268