Fix a bug in select.js
various enhancements