Change logic of validIp method and remove wrong log message.