Fixed bug

int i needs to be the values in selectedIndices, not the index of the
integers in selectedIndices. Before the layers wouldn't redraw, but this
maintains the reverse order.