Fixing algorithm