rewrite sel scripts