fix recursive bug