Cleaning up the semantics of count() and wrapped_count(), fixes #405.