1. A flash memory comprising: a plurity of memory elements, each having a control terminal, a program terminal and a threshold voltage; a program unit having an output node, wherein the program unit outputs a program current through the output node, and wherein the node has a node voltage; and a detecting unit, coupled to the program unit and the memory element for detecting the node voltage, and blocking the program current once the node voltage exceeds a reference voltage.