Fixed bug in script generation.
Added tests
Merge L084 en LI001