added getTotal functions and fixed option passing in findByIndex