update kernel and added some tweak and optimization