Correct set custom lib and undo action logic