updated js file to prevent udef errors