don't rely on String.trim()

ie < 9 fix