correct code error and add new functions