fixed failing if document.location.search is not empty