Fixes #433 and #420.