Fix concurrency bug when calling rpg program