COMPOSER: Fix uninitialized class variables and divide by zero bugs.

This was highlighted by Coverity in CID 1003844 and 1003410.