fix #41, #47, #49