add "Update rank function"
fix mistakes