Fixed handling of trailing space removal.