Fix bugs and test to suit precompile.spec