fix bug: do proper topological sort of updates
fix bug: do proper topological sort of updates

diku-kmc/repg,diku-kmc/repg,diku-kmc/repg,diku-kmc/repg,diku-kmc/repg,diku-kmc/repg,diku-kmc/kleenexlang,diku-kmc/kleenexlang,diku-kmc/kleenexlang,diku-kmc/kleenexlang,diku-kmc/kleenexlang,diku-kmc/kleenexlang