Fixed bugs processing records