Fixed shadow bug.

We missed logic.
Correctly count object ids.