Remove unused ids