fixing undefined js