Fixed up error codes and the resulting checks