Fix double usage of error code