Fixes to image scaling