fix some bugs with figures