Issue #416, #586 fixed