Manual Merge of Pull Request #407

Added a unit test to #407 while testing it.