fixes some bugs
add some functionalities