Minor optimization fixes