fixes #992
adds test for #992