Fixed issue #3 and issue #4