NH-3667 & NH-3102

https://nhibernate.jira.com/browse/NH-3667
https://nhibernate.jira.com/browse/NH-3102