Updated sync.php