Add nil checking to recursive_init