Lattice effects and phase competition in charge ordered manganites