Without seeing the data model, I am going to say try your original solution, but make sure you test for the member being empty as WELL AS being equal to zero.
Let's see if that works.
I am trying to give you a quick solution without having you rewrite the solution.