JavaScript Sync Problems?