fix #134 and other problems