Fix performance issues