Lattice and magnetic instabilities in C u 3 Bi ( Se O 3 ) 2 O 2 X ( X = Br , Cl )