Add test for issue 3989