fixed errors with repeated records