Regression test for fix 36596bf569a2764f527ab80a26992039daed9c67. #1387