reimplement select()