fix datatype issue in C code generator and add more tests for it