add takeIndex and assertThrows