Add test for failed count request; fix error in exception handling