Fixed an error in the adapt (to sex/age) template filter.