Some fixes in compilation function