Fixes #1209 and #1210