Port some minor changes from edge 0.9a version