Fixed getIndex calculation

Fixed a slight bug with the calculation of index in the quad tree.