Fix segfault at the first lock action