Fix errors in C code