small npe protection and resource freeing, no jira, just don't want to miss this possible problem