porting latest changes from private devtree