Fixes one-to-many and many-to-many issue with map escaping with-db context