Minor performance and test improvments