Added test

Added unit test  for fix #365