fixed repeat function