fixed issue using vanilla js