fix a bug in select