add logging.debug statements and fix UA string