Fix logical flaws.