Minor code adjustments and improved 'kassert'