Repair drag and drop function