Pull request: partly fixes #430 and #451.

@allanmc Review, bitte :mushroom: