Improved error reporting with positions