Change gid before uid