fixes #2992 and #2991

fixes #2992
fixes #2991