Fixes from @liquidsnake