fix tests and unexpected modifying User.devices field