Bug on get_url() function and some cleanup