fix issue #1313. Functional test passes