Fixed scope of ip_address db_api calls