Fix a bug with selecting columns when accessing many to many relation.
Merge branch '4.0'