Squashed commit of the following: fix JS errors
commit 0fa69a1cc256f84f394060ab2b484caebe6e1067