Fix logic flaw in lib.