Make user data preparation more robust when dealing with roles

See issue #220