Some fixes to incremental compilation. Generate constants code in main module.