Fixed datetime bug