fix type handler bug in substitution