Add test for issue 640