Improved error parsing