Fixed the modify function