CLN/BUG: indexing fixes (GH5725, GH5727)

closes #5727
closes #5725