init and prevent active index from overflowing