fixes #4373, #1640