Fix write measuring and endless loop in nearby approximation.