hotfix for group not working
added conditional addToArray Function