fix scaling issues. Fixes #623