Fixed NPE in before-date code