NH-3485

Fix and unit test
https://nhibernate.jira.com/browse/NH-3485