Fixed synchronization bugs and added script to run tests.