merge with mainstream

to be revised