Fixed #139
Fixed #142 and fixed #141