Add failing test and fix for #1422.

Fixes #1422.