fixing the exception in search