fixing scaling bug issue #386