fixed a bug in selection