added error check for getlogin and gethostname