Fixing error if program has no parent.