Fixes from commit f0142951cc