add features and fix bugs

add features and fix bugs