Synced with latest fixes on relational mapper.