more bug fixing caused from the refactoring of pn( scope issue)