fixed support for external URLs (which I previously broke) and added tests