Fix caching to use index of option instead of val