fix NPE when creating or editing event