Fix issue #3 and issue #4