Moved IP checking before DB-object assignment