Check error first