Fixed recovery endless loop, added efficient buffer maintenance