Fix issue #37 and update test cases
v20140620