3.0 fix contain count

Fixes #4511