Edited undoManager for searchFreeSlot's take method