Fixes for #22. Polyfills for trim() and indexOf()