Do not lock when no sync is necessary
add missing if before unlockSync