added sort by key for ptables