Fixes to javascript causing some functions not to run