several fixes, select implementation