added assert for index type checking