fixed ChangeSet apply and added tests