Refine utilities
Bug fix and rename registerfigure