Correct handling of EUID and EGID - fixes #3