fixed some indexing issues in pair correlation calculation