removed NPEs for users without group

A quick fix for several NullPointerExceptions when dealing with users without groups. 
I saw there are related tickets (I have not checked whether this patch may help there, too), and this may not be the whole deal, but it is still an improvement.
I just had this patch hanging around for a while, so I thought a pull request was in order.