added condition so denoms are not reducible to zero
fixed minor bug with denom constraints