fixed rtrim and add repeat
fix repeat