fixes #1951 and #1945

fixes #1945 and #1951