Fix few optimizations