check end time to prevent NPE