add sanity checks for dist2_to_box and max_dist2_to_box methods