Fixes handling of small images