fix #11, #9, #6