Ensure scala and javascript communicate nicely