fixes for static build without cg
Merge branch 'cgfix'