Fixed minor logic flaw