added in an error flag