Fix a few issues

Fixes #4113 and #4143