fixed issue 1339, faster IS_NOT_IN_DB