fixes issues #2840 #2852