Added null check of IP