Small performance fixes