fixed bug in image cropping