Fix issue #12 and #13