For upstream

Some minor fixes