Better error logging and fix bug whereby group would not be created.