Corrected recursive check