Fixed scaling problem, and tools scripts

Scaling was being applied before translation and rotation (which produced
some wierd effects due to being the wrong order) also fixed both of the
scripts in the tools directory