Fixed a bug in stub code generation