Fixed regression introduced by previous commit

  * Added a test to prevent future regressions