updated version
(from http://plugins.trac.wordpress.org/changeset/748315/p2p-wpml)
Fix metas sync when creating connections programmatically.
Removed unused $wpdb global
Tested on WP 3.6.1
Fixes ugly bug on commit 647808a96c3713b5428c8d0b611fef5feca07767
Merge pull request #15 from Gecka-Apps/master

Fix metas sync when creating connections programmatically and more