A solution to the anisotropy problem in bouncing cosmologies