fixed memory allocation issue with crop