Added unittest for #issue2816 and missing return statement
Merge pull request #2873 from noctarius/unittest-issue-2618

Added unittest for #issue2618 and missing return statement