fix #9 and #13