Fix bugs in scalebar and document it