Added unit test and fix for Issue #2 in github