$user-> removeRole('administrator') doesn't remove role I got php code that is suppouse to remove one role and add a new one to all users in given array. But unfortunatelly it just add new role but doesn't remove one. I tried alphanumeric values as $rid and straightforward numeric $id but still no effect. I tried putting error_logs inside loops and it's executed and printed to error_log.php.
Here's my code
foreach($users as $usr){
            $user = user_load_by_name($usr);
            $user-&gt;addRole('roleToAdd');
            $user-&gt;save();
        }
        foreach($users as $usr){
            $user = user_load_by_name($usr);
            $user-&gt;removeRole('roleToRemove');
            $user-&gt;save();
        }
}

Array
[0] =&gt; client1
[1] =&gt; client4

#edit 
I think it is worth to mention that roleToRemove is assigned to every new user that is registered using registration role module
FIXED check answers
Ok i found an answer.
The code is proper and it works. The problem was that I got module installed that assigned a role to new created users. I found out that it not only assign role when someone create new user but also when you was updating any of them. 
I've patched this bug and i got this hosted on my repo so if anybody needs it.
repo