bugfixes in javascript