fix scaling matrix code
implement cube scaling