fixed bug in remove_plinks()