Remove the unnecessary code from the error case