Fixes #859 Stopped JS error manifesting in the behaviour stated in #859