changed the logic to determine the user home dir