upgrade middl and entity