fixes unchecked variables

item may not have the trim method because of its type.