fixes after optimization