added more code to handle missing addresses