fix rotate and scale function