Fix bug in cropping logic
Merge branch 'crop-refactor' into dev