removing trailing empty strings