changed cropping function