Fix bug in migration table builder.
Fix arraying of relations.
Merge branch '4.0'