Fixed #139 and #149