fix a lot of compile problems with encode.c and cert.c (still not added to build)