Fix issues #13 and #12