Fixed Undo functionality in newer versions of Unity

* fixed undo functionality in unity 4.5 or newer