Changed the 'getPendingID' method to return null rather than zero and
adjusted all of the places that use it to fail gracefully.