fixed a bug and changed the scaling