Countrywide 's woes at the time of its purchase reflected the troubles of the overall US housing market and the big lender is particularly exposed to losses in the subprime mortgage market , which catered to borrowers with weak credit histories .