Fix run algorithm