Prevent lock from staying forever