fixed bug when ip was NULL