Fix index out of range exception
Make groups dictionaries thread safe
Ensure we don't try to get the contents of a null folder