Javascript bagfixes