Fixed assert statement for abstract entities

This fixes the issue in #437.