fixed null error in getReachablePositions