fix race condition
refactor ProgramLoader, RunProcess to remove static state