Improved assertion exception trimming logic.