Fix logic error in IP identification