Make private messaging inbox page appear under a tab

I managed to put the private messaging under a tab in a page named 'profile' page
see the following picture:
This is done by adding a function in childtheme which adds this new tab and put the inbox of private messaging inside it.
I have also sat the inbox page in the setting of private messaging to 'profile'
The problem is now, when I am in the inbox and I press on any button: unread, read, sent... the page is redirected to the first tab 'Account Details' in this same page, 'profile' page.

What I need is that I stay in the same tab when i press any button in the inbox, how is this possible?

You can create an account on and try it yourself if you need to more understand the situation.

Thanks a lot in advance!