Solution of problems with weak singularities in heterogeneous media using equilibrated basis functions and the finite element method