fixed a bug for optional parameters.