Will no longer fail when trying to cast a DateTime instance
Added test
Merge branch '4.1'