Fix a bug in select method.