Binding effects in the optical potential of pionic atoms