improve scale calculation