Fix bugs related to LockError exception

Signed-off-by: Álvaro Arranz <aarranz@fi.upm.es>