optimize code form user@host, and fix when host failed to ping