fixed some bugs, improved selecting items