fixed find() function sometimes inferring the wrong return type