Fixed a dangerous js bug