Fixed phase generator bugs due to resource sharing. Fixed glitches in
output also due to resource sharing.