Fixed bugs in select.