This should fix pendingchanges, need to do some more testing and cleanup