Fix a couple bugs found in the test suite.
Merge branch 'fs-performance-improvements' of https://github.com/michaeljbishop/emscripten into new-beta2