Corrected a bug when inserting a figure.