restore functionality of wrapping external scripts, fix #2448