fixes #3386
Merge pull request #3419 from dotCMS/issue-3386-deleting-environment-throws-error

fixes #3386