Fixing memory issues in ToolItem.createHandle()