Proposed fix for the issue introduced in #1176. See also #1190.