Bug fix of Issue #11 and #12