fix bug in LastPossible functions