Added a testcase for #157 and fixed #157 issue.