Fixed recursive bug