some fixes suggested by jslint