fix a bug in extractFigures