added simple test for search
fixed substr unexpected error