Fixed some missing unlocks before calling error() in DS API.