fix #22, #23, #24