A few minor changes

Change Region.isComplete and CompositeState.isComplete to consider null
and inactive current children in completeness test.
Other minor performance improvements.