Fix #9 and #12