Fixing problems with the rep function.