Fix seriously irritating indexing bug