Test patch for issue #1184

This was a quick test to see if my hypothesis about the reason for #1184 is correct. I don't fully understand this code, so it may not be a robust patch, but I think it illustrates the underlying issue.