fix some errors
add functions