fix bug in trimdata