Fixed an exception, when hProcess==0.
Made persistance work.