Fix small performance issues