bug fixes and changes to getPoolPosition