fix bug in get bottom most / top most id