Made locking mechanism more reliable. CURL command no longer continues where it left off in order to avoid errors.