Fixed a bug that causes syncing to fail if there are no layers