fixing issue with scales calculation