Added regression tests for #777.