Fixed some  bugs
Fixed  bugs and add more functions