switched final resize to ndcrop, which should avoid doing an extra reallocation