fix some bugs introduced in my last selection changes <g>