Various tweaks to fix typeahead.js