logic flaw fixed