Fixed #210 and #213 partially.