Fixes memory error when sorting processes tree.