toonetcreation Hi. I have no idea, but it does not work even with Protostar used, which means when our template and most of the modules are not used, so not affecting the functionality. Maybe it's caused by some 3rd party extension or due to some corrupted file in the installation. The case is that this is a first time I see a problem like that, so the script is best I can come up with.
BTW: Have You tried to replace this search with smart search module? Functionality will be same and this may actually not have this problem.