Fixed repeatFunctionTwice