update code synched from EM0074