No clue why it ever gets a -1 index though. (cherry picked from commit b12c7cf9633a9fc3a728a0ef44b5d50d621a7595)