Fixed indexing, reopened issue #5