BUG: indexing was wrong