Improve handling of RTL scripts