fix several bugs with timestamps in eloquent relations. fixes #1597.
Merge branch '4.0'