Fixed logic flaw