handle errors in url module better