Fixed error with datetimes
merged from master