some improvment and bug fixed