Improved error detection