Fix performance bug