This patch is to fix issue in both #11 and #13