update check valid url and handle errors