made changes to ondataset change to handle an empty dataset