copied utilities from PActor