Fixed bug in image cropping