small changes in solve and merge