Logic minimalizer bugfix