iOS fixes

Various fixes for problems discovered while using NNKit on iOS.