Fixed some bugs and typos in select-function