fix scaling and tests