fixed all known bugs with check_contiguity

weird thing is, I'm not really 100% certain what I changed, exactly. the
logic of the function remains true to its original intent. so it was
something obscure, or something I'm still missing. oh well