some fix and optimization