improved error formatting