Change some idOwner = %i to be (idOwner is null or idOwner = %i)