fixed bugs in getting scaled images