Fixed issue #2 and issue #3