Bugfixes with javascript