fix #16 and maybe #18