dirty fix to prevent segmentation fault on pdisconnection