resolving a bug in select