some minor optimizations.