modify scale function