Fix wrong assertion

Fixes issue #2196