Bug fixes for smartsync.js / all tests passing