fix #1186 should also take care of #1185