fixed #138 and #142