add a function to write data, add a AM mod script