fix #171, fix #170, fix #169, fix #165, fix #163, fix #155