Fixed a logical issue