changed logic to determine trusted server