Fixing search inside function.