fix #143, #144, #145, #146