fixed duplicate names with spaced

also fixed too long name error for group,
trim func is now exported and converts value to string firstly