Fix scale function.