Fix #8 and #13