Add tests for #3142
Fix #3142
Code cleanups
Add comments in the modified code section
Merge pull request #3269 from yakky/feature/issue_3142

Instantiate classes before passing them to reverse as args