Fixed problems with the computation of multiple holes.
Added sanity check.