Fixing bug: parsing final element