Bug fixes and jslint