Issues #142 and #143 fixed