some minor perf optimizations