fixed a few bugs with scaling