compile and fix globals