optimizer fixes