Fix issue #9462 with returning rvalue reference instead of returning by copy
Removed a few whitespaces
Added some tests to cover case from #9462
Merge branch 'develop'