Fixed error in core if