Bug fixes and flip-flop-data gate