Minor fix and optimization.