Fix #19 and #18 bugs.