replace deprecated codes to new codes