fix #16 and other stuff