Fixed small performance errors