Fix boxed_coords to allow reversed range and add tests