Fixing perf issues