some fixes and add new fuctions