added error handling for case that IP isn't printed to logfile