Replacing assert with a corrected one (see #1308)