fix #2817, #2814, #2811