Fixed undefined variable bug

This hopefully fixes the bug that causes the syncing to fail Closes #16