add exception handling when searching