NH-3575

Fix and unit tests
https://nhibernate.jira.com/browse/NH-3575