changed error detection cases around