fixing bug 3302 and adding test
Merge branch 'topic/bug3302'

* topic/bug3302:
  fixing bug 3302 and adding test