some refactoring in KRunProgram to help fixing argument quoting