Fixes #3210 and #3209