fix change orientation bug with diagram