fix #26, #22, #35, #36, #37