Fixes from upstream