Added exception handler to catch malformed urls