Added check for errors in demo app.