updated to latest code from "next" branch