Bugfixes from testing on iOS