Added check for empty search term