escaping urls and preparing for garbage collection