Amount Generator: make sorting by dependency resolution really stable