bug fixed and add more functions