Add test coverage for #585