Fix checks for return values of find() and rfind()