fixing pause bug caused by scope cause I dont know js