fixed function that replaces a given dataset