Fix #11, #12, #18, #19