add some functions and fix.