Fix warnings and added setgid