fix #20; fix #15; fix #22