fix order of deallocation in ApplicationDelegate