correct bugs, modification of some functions