Fix problem where js code isn't initializing properly