Added test for badges._fetch. Fixed bug discovered in _fetch by tests.