Fix issue #11 and issue #12