Small fixes, hopefully ready for jQuery