added fix for long dimensioned images