added code to remove empty space that was producing an error: Cropping error (TypeError: Cannot read property geometry of undefined)