Add scale and fix some bugs