Fixing some errors in the c code.