Added missing initialization and NULL-check in Application