improve compile script and use it