Attempting to fix type error on loading js