iOS fixes (hopefully) and assorted bug squashing