Fix implementation of alias expansion (#264, #265)

Change compilation order, module dependencies is getting quite
complicated...