Add error handling for invalid addresses