resolve #327 . Unit test is included.