Fixed bug in the timing for generating voltages