Fixes #2, adjust return indices correctly