Fixed an off-by-one comparison against MAX_BASIS_DIRS.