Fix script execution with large output (fix #325)