fix dict[len] bug and add initializeSync

This is my first pull request, I hope I do this correctly