Fix several scripts device code.