Fix #8, #9, #16, #18